package tianwang.model;

/**
 * 同数据库中的td表结构
 */
public class TDModel {
	/**
	 * 唯一标示标识
	 */
	private Integer id = null;
	/**
	 * 单词对,比如dog my
	 */
	private String pairs = "";
	
	/**
	 * 两个单词间依赖的类型,比如poss
	 */
	private String td = "";
	/**
	 * 单次对左的那个,比如dog-2
	 */
	private String left = "";
	/**
	 * 单次对右面的那个,比如my-1
	 */
	private String right = "";
	/**
	 * 单次对所在的句子
	 */
	private String context = "";
	/**
	 * 来自于那份语料,比如voa或者某个链接等
	 */
	private String from = "";
	
	/**
	 * 使用td的字符串形式进行初始化
	 * 字符串的形式为：poss(dog-2, My-1)
	 * @param tdString
	 */
	public TDModel(String tdString){
		String[] tmp = tdString.split("\\(");
		this.td = tmp[0];
		String lr = tmp[1].replace(")", "");
		
		tmp = lr.split(",");
		this.left = tmp[0].trim();
		this.right = tmp[1].trim();
		
		this.pairs = this.left.split("\\-")[0] + " " + this.right.split("\\-")[0];
	}
	
	public Integer getId() {
		return id;
	}
	
	public String getPairs() {
		return pairs;
	}
	public void setPairs(String pairs) {
		this.pairs = pairs;
	}
	public String getTd() {
		return td;
	}
	public void setTd(String td) {
		this.td = td;
	}
	/**
	 * 单次对左的那个,比如dog-2
	 */
	public String getLeft() {
		return left;
	}
	/**
	 * 单次对左的那个,比如dog-2
	 */
	public void setLeft(String left) {
		this.left = left;
	}
	public String getRight() {
		return right;
	}
	public void setRight(String right) {
		this.right = right;
	}
	public String getContext() {
		return context;
	}
	public void setContext(String context) {
		this.context = context;
	}
	public String getFrom() {
		return from;
	}
	public void setFrom(String from) {
		this.from = from;
	}
}
